package com.appdatebase;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

import com.appcommon.*;

public class QueryUserInfo {

	private String stuId = "stuId";
	private String stuName = "stuName";
	private String stuSex = "stuSex";
	private String stuFrom = "stuFrom";
	private String stuBir = "stuBir";
	private String stuStatus = "stuStatus";
	private String stuColloge = "stuColloge";
	private String stuClass = "stuClass";
	
	public HashMap<String, String> getInfo(String Id) {
//		System.out.println(Id);
		HashMap<String, String> hashMap = new HashMap<>();
		ConnectDataBase dataBase = new ConnectDataBase("studentinfo");
		dataBase.connect();
		ResultSet resultSet = dataBase.getResultSet();
		
		try {
			while (resultSet.next()) {
				if (resultSet.getString(stuId).equals(Id)) {
					hashMap.put(stuId, resultSet.getString(stuId).toString());
					hashMap.put(stuName, resultSet.getString(stuName).toString());
					hashMap.put(stuSex, resultSet.getString(stuSex).toString());
					hashMap.put(stuBir, resultSet.getString(stuBir).toString());
					hashMap.put(stuFrom, resultSet.getString(stuFrom).toString());
					hashMap.put(stuStatus, resultSet.getString(stuStatus).toString());
					hashMap.put(stuColloge, resultSet.getString(stuColloge).toString());
					hashMap.put(stuClass, resultSet.getString(stuClass).toString());
//					System.out.println(resultSet.getString("stuName"));
				}
			}
		
		dataBase.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return hashMap;
	}
}
